#ifndef __UPGRADE_H__
#define __UPGRADE_H__

#define MEMMAP_FLASH_START		0x08000000

#define MEMMAP_LOADER_START		MEMMAP_FLASH_START
#define MEMMAP_LOADER_SIZE		(28 * 1024)
#define MEMMAP_LOADER_END		(MEMMAP_LOADER_START + MEMMAP_LOADER_SIZE)

#define MEMMAP_EFIT_START		MEMMAP_LOADER_END
#define MEMMAP_EFIT_SIZE		(4 * 1024)
#define MEMMAP_EFIT_END			(MEMMAP_EFIT_START + MEMMAP_EFIT_SIZE)

#if 0
#define MEMMAP_APP_START		(MEMMAP_EFIT_END)
#define MEMMAP_APP_SIZE			(28 * 1024)
#define MEMMAP_APP_END			(MEMMAP_APP_START + MEMMAP_APP_SIZE)

#define MEMMAP_UPGRADER_START	(MEMMAP_APP_END)
#define MEMMAP_UPGRADER_SIZE	(4 * 1024)
#define MEMMAP_UPGRADER_END		(MEMMAP_UPGRADER_START + MEMMAP_UPGRADER_SIZE)
#endif

#define RUN_STAGE_APP		0
#define RUN_STAGE_LOADER	1
#define RUN_STAGE_UPGRADER	2

int check_app(void);
void setup_stage(void);
void upgrade_start(void);
void app_start(void);

#endif
